<template>
	<view class="zljc-container">
		<topNav
			class="home-top"
			title="审批处理 "
			:isUnderline="true"
			backgroundColor="#fe689b"
			color="#ffffff"
			:isCustomBackEvent="true"
			@backCallback="backCallback"
		></topNav>
		<view class="tab-box">
			<view
				class="tab-item"
				:class="{ active: active == 1 }"
				@click="tabClick(1)"
				>待处理</view
			>
			<view
				class="tab-item"
				:class="{ active: active == 2 }"
				@click="tabClick(2)"
				>已处理</view
			>
		</view>
		<view class="search-box">
			<view class="search-content">
				<view class="search-block">
					<u-icon name="search" color="#ababab" size="28"></u-icon>
					<view class="search-text">搜索</view>
				</view>
			</view>
		</view>
		<view class="list-content">
			<scroll-view
				class="list-container"
				scroll-y="true"
				:style="'height:' + listHeight + 'px;'"
			>
				<view
					class="list-item"
					v-for="(item, index) in list"
					:key="index"
					@click="listClick(item)"
				>
					<view class="list-title">{{ item.title }}</view>
					<view class="list-desc">{{ item.bus }}</view>
					<view class="list-desc"
						>{{ item.time }} 提交人：{{ item.person }}</view
					>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
import { mapState } from "vuex";
export default {
	data() {
		return {
			active: 1,
			scroll: 0,
			list: [],
			json: {
				1: [
					{
						title: "1、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "2、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "3、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "4、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "5、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "6、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "7、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "8、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "9、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "10、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "11、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
					{
						title: "12、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "待处理",
					},
				],
				2: [
					{
						title: "1、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "已处理",
					},
					{
						title: "2、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "已处理",
					},
					{
						title: "3、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "已处理",
					},
					{
						title: "4、护理安全管理质量检查考核表（护理部）（护理部）",
						time: "2020-12-01 11:02:01",
						bus: "质量检查",
						person: "小张",
						status: "已处理",
					},
				],
			},
		};
	},
	mounted() {
		this.getData();
	},
	methods: {
		backCallback() {
			uni.switchTab({
				url: "/pages/index/index",
			});
		},
		tabClick(index) {
			this.active = index;
			this.getData();
		},
		getData() {
			this.list = this.json[this.active];
		},
		listClick(item) {
			uni.navigateTo({
				url: "/pages/index/audit/detail",
			});
		},
	},
	computed: {
		...mapState({
			listHeight: (state) => {
				return (
					state.systemInfo.screenHeight -
					(state.systemInfo.top_topNav +
						uni.upx2px(40) +
						uni.upx2px(40) +
						uni.upx2px(72))
				);
			},
		}),
	},
};
</script>

<style lang="scss" scoped>
.zljc-container {
	background-color: #f7f7f7;
	.tab-box {
		background-color: #ffffff;
		display: flex;
		border-bottom: 2rpx solid rgba(0, 0, 0, 0.1);
		.tab-item {
			flex: 1;
			text-align: center;
			color: #000000;
			position: relative;
			font-size: 28rpx;
			line-height: 42rpx;
			padding: 16rpx 0;
		}
		.active {
			border-bottom: 4rpx solid #fe689b;
		}
	}

	.search-box {
		padding: 16rpx;
		.search-content {
			background-color: #ffffff;
			border-radius: 8rpx;
			display: flex;
			justify-content: center;
			padding: 8rpx;
			.search-block {
				display: flex;
				.search-text {
					margin-left: 8rpx;
					font-size: 24rpx;
					color: #ababab;
				}
			}
		}
	}

	.info-box {
		background-color: #ffffff;
		color: #000000;
		height: 216rpx;
		.info-title {
			font-weight: bold;
			padding: 16rpx 48rpx;
			border-bottom: 2rpx solid rgba(0, 0, 0, 0.1);
		}
		.info-other {
			padding: 16rpx 32rpx;
			.info-rows {
				display: flex;
				display: flex;
				font-size: 24rpx;
				line-height: 36rpx;
			}
		}
	}
	.type-box {
		background-color: #ffffff;
		margin-top: 16rpx;
		border-bottom: 2rpx solid rgba(0, 0, 0, 0.1);
	}
	.list-content {
		.list-container {
			.list-item {
				background-color: #ffffff;
				padding: 16rpx 32rpx;
				border-bottom: 2rpx solid rgba(0, 0, 0, 0.1);
				position: relative;

				.list-title {
					font-size: 28rpx;
					line-height: 40rpx;
					color: #000000;
				}
				.list-desc {
					font-size: 24rpx;
					line-height: 36rpx;
					color: gray;
					margin-top: 8rpx;
				}
			}
			.list-item::after {
				position: absolute;
				content: "";
				width: 24rpx;
				height: 28rpx;
				top: 22rpx;
				right: 22rpx;
				background-image: url("@/static/images/my/icon_jump.png");
				background-repeat: no-repeat;
				background-size: 100% 100%;
			}
		}
	}
}
</style>
